package com.crimsec.utils.snmp.service;

import com.crimsec.utils.snmp.model.Mibent;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;

/**
 *
 * @author moroz
 */
@Stateless
public class MibentService {

    @PersistenceContext
    EntityManager em;

    public Long getCount() {
        TypedQuery<Long> qc = em.createQuery("SELECT Count(m) FROM Mibent m", Long.class);
        //TODO: check null here
        return qc.getSingleResult().longValue();
    }

    public Mibent get(short id) {
        return em.find(Mibent.class, id);
    }
}
